package palms.locationserver;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class LocationServer {

	public static void main(String[] args) {
		
		LocationLogic ll = new LocationLogic();

		try {
			System.out.println("####");
			System.out.println("Location Server is online.");
			System.out.println("####");
			System.out.println("-->Waiting for requests...");
			ServerSocket ssocket = new ServerSocket(ll.getSlport());
			while(true){
				Socket s = ssocket.accept();
				System.out.println("-->Received a connection...");
				LocationWorker worker = new LocationWorker(s, ll);
				Thread t = new Thread(worker);
				t.start();
				System.out.println("-->Launched a worker to process message...");
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		

	}
}
